package cn.com.idmy.auth.login;

import cn.com.idmy.auth.exception.AuthException;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;

@Getter
public class LoginException extends AuthException {
    /**
     * 表示 token 无效
     */
    public static final String INVALID_TOKEN = "-2";
    public static final String INVALID_TOKEN_MESSAGE = "token 无效";

    /**
     * 表示 token 已过期
     */
    public static final String TOKEN_TIMEOUT = "-3";
    public static final String TOKEN_TIMEOUT_MESSAGE = "token 已过期";

    /**
     * 表示 token 已被顶下线
     */
    public static final String BE_REPLACED = "-4";
    public static final String BE_REPLACED_MESSAGE = "token 已被顶下线";

    /**
     * 表示 token 已被踢下线
     */
    public static final String KICK_OUT = "-5";
    public static final String KICK_OUT_MESSAGE = "token 已被踢下线";

    /**
     * 表示 未按照指定前缀提交 token
     */
    public static final String NO_PREFIX = "-7";
    public static final String NO_PREFIX_MESSAGE = "未按照指定前缀提交 token";

    private final String type;
    private final long accountType;

    public LoginException(long accountType, @NotNull String type, @NotNull String message) {
        super(message);
        this.accountType = accountType;
        this.type = type;
    }

    public LoginException(long accountType, @NotNull String type, @NotNull String message, @NotNull String token) {
        super(message + "：" + token);
        this.accountType = accountType;
        this.type = type;
    }
}
